 package srdb.migration.dbhandler.enterprisedb;
 
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
import org.apache.log4j.Logger;

import srdb.migration.Utility;
 
 class StreamRedirector extends Thread
 {
   InputStream toread = null;
   OutputStream towrite = null;
 
   boolean errorFlag = false;
 
   StreamRedirector(InputStream toread, OutputStream towrite)
   {
     this.toread = toread;
     this.towrite = towrite;
   }
 
   public void run()
   {
     try {
       int BUFFER_SIZE = 1024;
       byte[] data = new byte[BUFFER_SIZE];
       int size = 0;
       while ((size = this.toread.read(data)) > 0) {
         this.towrite.write(data, 0, size);
         this.towrite.flush();
       }
     } catch (IOException ioe) {
       Utility.getLogger().error(ioe.getMessage(), ioe.fillInStackTrace());
       this.errorFlag = true;
     } finally {
       try {
         this.towrite.flush();
         this.towrite.close();
       }
       catch (IOException ex)
       {
       }
     }
   }
 }

/* 

 * 
 */